﻿@{
    ViewBag.Title = "修改密码";
    Layout = "~/Views/Shared/_Form.cshtml";
}
@model Raffles.OA.Data.User
<form class="form-horizontal m" role="form" id="form">
    <div class="form-group">
        <label class="control-label col-sm-3">用户名<font class="text-red">&nbsp;&nbsp;</font></label>
        <div class="col-sm-9 form-valid">
            <input type="text" id="userName" name="RealName" col="RealName" placeholder="用户名" value="@Model.Account" class="form-control required" readonly="readonly" formRules="isNonEmpty" , formError="必填"/>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-sm-3">旧密码<font class="text-red">*</font></label>
        <div class="col-sm-9 form-valid">
            <input type="password" id="oldpassword" placeholder="请输入旧密码" class="form-control required" formRules="isNonEmpty" , formError="必填" />
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-sm-3">新密码<font class="text-red">*</font></label>
        <div class="col-sm-9 form-valid">
            <input type="password" id="newPassword" placeholder="请输入新密码" class="form-control required" formRules="isNonEmpty" , formError="必填"/>
        </div>
    </div>
</form>
<script type="text/javascript">
    var id = frame.request("id");
    function saveForm() {
        if ($('form').validate('submitValidate')) {
            frame.ajax({
                url: '@Url.Content("/Login/ChangePasswordJson")',
                type: "post",
                data: $('form').formSerialize(),
                success: function (obj) {
                    if (obj.success) {
                        frame.msgSuccess(obj.message);
                        frame.closeDialog();
                        parent.reload();
                    }
                    else {
                        frame.msgError(obj.message);
                    }
                }
            });
        }
    }
</script>